<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>重设密码</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="Expires" CONTENT="0">
    <meta http-equiv="Cache-Control" content="no-siteapp,no-transform,no-store, no-cache, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <link rel="shortcut icon" href="./../../../favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="./../../../static/css/font.css">
    <link rel="stylesheet" href="./../../../static/css/weadmin.css">
    <script type="text/javascript" src="/lib/layui/layui.js" charset="utf-8"></script>
    <link rel="stylesheet" href="../../../static/css/buildUnit/common.css">
    <style>
        .content {
            padding: 20px;
        }

        .layui-container {
            padding-top: 20px;
        }

        .layui-form-pane .layui-form-label {
            width: 135px;
        }

        .layui-form-pane .layui-input-block {
            margin-left: 135px;
        }
    </style>
</head>
<body>
<div class="layui-container replaceStr">
    <form class="layui-form layui-form-pane" action="" lay-filter="example">
        <div class="layui-form-item">
            <label class="layui-form-label required">原密码</label>
            <div class="layui-input-block">
                <input type="password" name="oldPassword" autocomplete="off" lay-verify="required"
                       placeholder=""
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">新密码</label>
            <div class="layui-input-block">
                <input type="password" name="newPassword" autocomplete="off" lay-verify="required|upass"
                       placeholder=""
                       class="layui-input password">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">确认新密码</label>
            <div class="layui-input-block">
                <input type="password" name="" autocomplete="off" lay-verify="required|upass"
                       placeholder=""
                       class="layui-input rePassword">
            </div>
        </div>

        <button lay-submit lay-filter="demo1" style="display: none;" class="demo1">提交</button>
    </form>
</div>
<script src="../../../static/js/main.js"></script>
<script type="text/javascript">
    layui.use(['jquery', 'permission', 'sessionFun', 'form', 'configureCom', 'configure', 'bluebird'], function () {
        window.form = layui.form;
        var configureCom = layui.configureCom;
        var configure = layui.configure;
        window.$ = window.jQuery = layui.$;
        var userName = window.parWin.userName;
        //监听提交
        form.on('submit(demo1)', function (data) {
            var data = data.field;
            if ($('.rePassword').val() != $('.password').val()) {
                top.layer.msg('俩次输入的新密码不一致');
                return false;
            }
            data.userName = userName;
            var url = configure.MODIFY_PASSWORD_HTML;
            configureCom.getAjax(url, data).then(function (res) {
                if (res.code == 1) {
                    top.layer.alert('重设密码成功,请重新登录', {
                        end: function () {
                            top.loginOut();
                        }
                    });
                } else {
                    top.layer.msg(res.msg);
                }
            });
            return false;
        });
    });
</script>
</body>
</html>